Skip to content

Reserve run ownership before installing worker deadlines - #31

Draft
mtwilliams wants to merge 1 commit into
codex/ortex-final-validationfrom
codex/ortex-run-reservation
Draft

mtwilliams wants to merge 1 commit into
codex/ortex-final-validationfrom
codex/ortex-run-reservation

Conversation

@mtwilliams

@mtwilliams mtwilliams commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes a managed-run ownership race: a duplicate call could expire or lose its caller before reaching native validation, then cancel the legitimate original attempt sharing that control. The caller now atomically reserves the model-bound control before creating a watcher/deadline. Native entry consumes the reservation once; direct internal NIF calls remain one-attempt. Rejected duplicates acquire no cancellation ownership.

The resource is versioned OrtexRunControlV2. started?/1 reports native entry (including mutex waiting), separately from reservation, and a zero-deadline attempt consumes its reservation without launching a worker. Upgrades require a fresh VM.

Validation: 218 checks passed on runtimes 1.17.3 and 1.24.4 (two optional ResNet checks excluded). Deterministic regressions cover a zero-deadline duplicate before native entry, wrong-model zero-deadline reuse, and 16 concurrent public reservations with exactly one successful owner. Focused rerun and all-provider/diagnostic-feature cargo check passed. A further 100,000 bounded calls per runtime preserved golden scores, process count 124, and bounded RSS samples (1.17.3: 103.5–105.6 MB; 1.24.4: 108.0–110.1 MB).

Stacked on #30. This closes the ownership window in #28 and completes the combined integration stack. The current combined stack, including this ownership fix, has completed validation below. Fork only. Task commit unsigned because the signing agent cancels requests.

Final combined validation is green at a4cef8490858d89b7827ef6e62ba652107434373 on codex/ortex-integration:

  • Source matrix: API 17/runtime 1.17.3, API 17/runtime 1.24.4, API 24/runtime 1.24.4, and both Alpine architectures.
  • Precompiled consumers and package: all seven CPU targets and complete checksum/package assembly passed with compiler execution forbidden during consumer testing. Release/tag-only jobs were intentionally skipped.
  • Local suite: 218 checks passed on both runtimes; two optional external ResNet cases excluded. Long ordinary/load-disposal/bounded diagnostics checked every golden score, and post-reservation bounded soaks retained flat process counts and bounded sampled memory.

Review in stack order #2–#31. Preserve ancestry with merge commits, or rebase/retarget the remaining stack after squash/rebase merges. The worktree is clean. Fresh VM required for native resource upgrades. No upstream writes, release tags, or Hex publication were performed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant